package com.example.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author yunan
 * @since 2023-04-13
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class News extends Model<News> {

    private static final long serialVersionUID=1L;

      @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private String title;

    private String author;

    private LocalDateTime createTime;

    private String summary;

    /*
    * @TableField注解用于在数据库的列名和实体类的属性名不同时，做映射
    * 当数据库中没有这个列对应该属性时，直接使用exist=false表示没有数据
    * */
    @TableField(exist = false)
    private NewsContent content;

    private Long viewnum;

}
